```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java分支语句完全指南 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
        }
        .code-block {
            background-color: #1e293b;
            border-radius: 0.5rem;
            position: relative;
        }
        .code-header {
            background-color: #334155;
            border-top-left-radius: 0.5rem;
            border-top-right-radius: 0.5rem;
            padding: 0.5rem 1rem;
            color: #94a3b8;
            font-family: monospace;
        }
        .code-content {
            padding: 1rem;
            color: #e2e8f0;
            font-family: monospace;
            white-space: pre;
            overflow-x: auto;
        }
        .concept-card:hover {
            transform: translateY(-4px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .assignment-card:hover {
            transform: scale(1.02);
        }
        .mermaid {
            background-color: white;
            padding: 1.5rem;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        }
        .first-letter:first-letter {
            font-size: 3.5rem;
            float: left;
            line-height: 1;
            margin-right: 1rem;
            margin-top: 0.5rem;
            color: #4f46e5;
            font-weight: bold;
        }
        .section-divider {
            height: 2px;
            background: linear-gradient(90deg, transparent 0%, #4f46e5 50%, transparent 100%);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:px-0">
        <div class="container mx-auto max-w-5xl flex flex-col md:flex-row items-center">
            <div class="md:w-1/2 mb-10 md:mb-0">
                <h1 class="text-4xl md:text-5xl font-bold leading-tight mb-4">掌握Java分支语句</h1>
                <p class="text-xl text-indigo-100 mb-8">通过条件控制实现程序逻辑的艺术</p>
                <div class="flex space-x-4">
                    <a href="#if-statement" class="bg-white text-indigo-600 px-6 py-3 rounded-lg font-medium hover:bg-indigo-50 transition duration-300">
                        <i class="fas fa-code mr-2"></i> if语句
                    </a>
                    <a href="#switch-statement" class="bg-indigo-700 text-white px-6 py-3 rounded-lg font-medium hover:bg-indigo-800 transition duration-300">
                        <i class="fas fa-random mr-2"></i> switch语句
                    </a>
                </div>
            </div>
            <div class="md:w-1/2 flex justify-center">
                <div class="mermaid w-full max-w-md">
                    graph TD
                    A[程序开始] --> B{条件判断}
                    B -->|条件为真| C[执行代码块]
                    B -->|条件为假| D[执行其他代码]
                    C --> E[程序继续]
                    D --> E
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-5xl py-12 px-4 md:px-0">
        <!-- Introduction -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 w-12 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">分支语句概述</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md p-8">
                <p class="text-gray-700 mb-6 first-letter">分支语句是编程中常用的一种控制结构，用于根据条件选择不同的执行路径。在Java中，主要有if语句和switch语句两种形式的分支语句，它们可以让程序根据不同的条件执行不同的代码块，从而实现更复杂的逻辑控制。</p>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="concept-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:border-indigo-300">
                        <div class="text-indigo-500 mb-4">
                            <i class="fas fa-question-circle text-3xl"></i>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">概念</h3>
                        <p class="text-gray-600">根据条件决定程序执行路径的控制结构</p>
                    </div>
                    <div class="concept-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:border-indigo-300">
                        <div class="text-indigo-500 mb-4">
                            <i class="fas fa-check-circle text-3xl"></i>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">if语句</h3>
                        <p class="text-gray-600">基于布尔表达式的条件判断</p>
                    </div>
                    <div class="concept-card bg-white border border-gray-200 rounded-lg p-6 transition duration-300 hover:border-indigo-300">
                        <div class="text-indigo-500 mb-4">
                            <i class="fas fa-random text-3xl"></i>
                        </div>
                        <h3 class="text-lg font-semibold mb-2">switch语句</h3>
                        <p class="text-gray-600">基于表达式的值进行多分支选择</p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Divider -->
        <div class="section-divider my-12"></div>

        <!-- if Statement -->
        <section id="if-statement" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 w-12 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">if语句详解</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md p-8 mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">基本结构</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
if (condition) {
    // 当条件为真时执行的代码块
} else {
    // 当条件为假时执行的代码块
}
                    </div>
                </div>
                <p class="text-gray-700 mb-6">if语句用于执行基于布尔表达式的条件判断，根据判断结果选择执行不同的代码块。可以使用多个else if来添加额外的条件分支。</p>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">示例代码</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
public class Main {
    public static void main(String[] args) {
        int num = 5;

        // 使用if语句判断数字的大小
        if (num > 0) {
            System.out.println("Number is positive");
        } else if (num < 0) {
            System.out.println("Number is negative");
        } else {
            System.out.println("Number is zero");
        }
    }
}
                    </div>
                </div>
            </div>

            <!-- Nested if -->
            <div class="bg-white rounded-xl shadow-md p-8 mb-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">多重if语句</h3>
                <p class="text-gray-700 mb-6">可以根据不同条件进行多重判断，下面是一个多重if语句的案例，根据用户输入的成绩，判断其等级：</p>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
import java.util.Scanner;

public class GradeEvaluator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入成绩：");
        int score = scanner.nextInt();

        if (score >= 90) {
            System.out.println("优秀！");
        } else if (score >= 80) {
            System.out.println("良好！");
        } else if (score >= 70) {
            System.out.println("中等！");
        } else if (score >= 60) {
            System.out.println("及格！");
        } else {
            System.out.println("不及格！");
        }

        scanner.close();
    }
}
                    </div>
                </div>
            </div>

            <!-- Nested if -->
            <div class="bg-white rounded-xl shadow-md p-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">嵌套if语句</h3>
                <p class="text-gray-700 mb-6">在if或else语句中嵌套if语句，可以实现更加复杂的条件判断逻辑。下面是一个嵌套if语句的案例，根据用户输入的年份和月份，判断该月份有多少天：</p>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
import java.util.Scanner;

public class DaysInMonth {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入年份：");
        int year = scanner.nextInt();

        System.out.print("请输入月份：");
        int month = scanner.nextInt();

        int daysInMonth;

        if (month == 2) {
            if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
                daysInMonth = 29;
            } else {
                daysInMonth = 28;
            }
        } else if (month == 4 || month == 6 || month == 9 || month == 11) {
            daysInMonth = 30;
        } else {
            daysInMonth = 31;
        }

        System.out.println(year + "年" + month + "月有" + daysInMonth + "天");

        scanner.close();
    }
}
                    </div>
                </div>
            </div>
        </section>

        <!-- Divider -->
        <div class="section-divider my-12"></div>

        <!-- switch Statement -->
        <section id="switch-statement" class="mb-16">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 w-12 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">switch语句详解</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md p-8">
                <h3 class="text-xl font-semibold mb-4 text-gray-800">基本结构</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
switch (expression) {
    case value1:
        // 当表达式的值等于value1时执行的代码块
        break;
    case value2:
        // 当表达式的值等于value2时执行的代码块
        break;
    default:
        // 当表达式的值与任何case都不匹配时执行的代码块
        break;
}
                    </div>
                </div>
                <p class="text-gray-700 mb-6">switch语句用于根据表达式的值选择执行不同的代码块，适用于多个条件的判断。switch语句中的每个case标签后面的代码块可以有一个可选的break语句，用于终止switch语句的执行。</p>
                
                <h3 class="text-xl font-semibold mb-4 text-gray-800">示例代码</h3>
                <div class="code-block mb-6">
                    <div class="code-header">
                        <i class="fas fa-circle text-red-400 mr-2"></i>
                        <i class="fas fa-circle text-yellow-400 mr-2"></i>
                        <i class="fas fa-circle text-green-400 mr-2"></i>
                    </div>
                    <div class="code-content">
public class Main {
    public static void main(String[] args) {
        int num = 5;
        // 使用switch语句判断星期几
        int day = 3;
        switch (day) {
            case 1:
                System.out.println("Monday");
                break;
            case 2:
                System.out.println("Tuesday");
                break;
            case 3:
                System.out.println("Wednesday");
                break;
            default:
                System.out.println("Other day");
                break;
        }
    }
}
                    </div>
                </div>
            </div>
        </section>

        <!-- Divider -->
        <div class="section-divider my-12"></div>

        <!-- Summary -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 w-12 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">总结与注意事项</h2>
            </div>
            <div class="bg-white rounded-xl shadow-md p-8">
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="text-xl font-semibold mb-4 text-gray-800">if语句注意事项</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>注意条件的顺序，确保逻辑正确</li>
                            <li>确保覆盖所有可能的情况</li>
                            <li>避免过于复杂的嵌套结构</li>
                            <li>合理使用大括号，即使只有一行代码</li>
                        </ul>
                    </div>
                    <div>
                        <h3 class="text-xl font-semibold mb-4 text-gray-800">switch语句注意事项</h3>
                        <ul class="list-disc pl-5 text-gray-700 space-y-2">
                            <li>确保每个case都有break语句，除非有意使用穿透</li>
                            <li>default分支处理未匹配的情况</li>
                            <li>表达式类型必须与case标签兼容</li>
                            <li>避免过于复杂的switch语句结构</li>
                        </ul>
                    </div>
                </div>
                <div class="mt-8 p-6 bg-indigo-50 rounded-lg">
                    <h3 class="text-xl font-semibold mb-4 text-indigo-800">核心要点</h3>
                    <p class="text-indigo-700">Java中的分支语句，包括if语句和switch语句的基本用法和注意事项，希望通过学习，你能够掌握分支语句的应用，编写出清晰和灵活的Java程序。</p>
                </div>
            </div>
        </section>

        <!-- Divider -->
        <div class="section-divider my-12"></div>

        <!-- Assignments -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <div class="h-1 bg-indigo-500 w-12 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">实践作业</h2>
            </div>
            <div class="grid md:grid-cols-1 gap-6">
                <div class="assignment-card bg-white rounded-xl shadow-md p-6 transition duration-300 hover:shadow-lg">
                    <div class="flex items-start">
                        <div class="bg-indigo-100 text-indigo-600 rounded-full p-3 mr-4">
                            <i class="fas fa-car text-xl"></i>
                        </div>
                        <div>
                            <h3 class="text-lg font-semibold mb-2 text-gray-800">作业1: 购车选择程序</h3>
                            <p class="text-gray-600 mb-4">某朋友说，如果存款超过100万，则入手宝马X5，否则超过50万，则入手奥迪A6，否则超过20万，则入手比亚迪，否则超过10万则玩玩极品飞车游戏，请编写一个购车选择程序，根据输入的金额，提示可以购买的车型。</p>
                            <div class="flex space-x-2">
                                <span class="bg-indigo-100 text-indigo-600 px-3 py-1 rounded-full text-sm">if语句</span>
                                <span class="bg-indigo-100 text-indigo-600 px-3 py-1 rounded-full text-sm">多重条件</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="assignment-card bg-white rounded-xl shadow-md p-6 transition duration-300 hover:shadow-lg">
                    <div class="flex items-start">
                        <div class="bg-indigo-100 text-indigo-600 rounded-full p-3 mr-4">
                            <i class="fas fa-gift text-xl"></i>
                        </div>
                        <div>
                            <h3 class="text-lg font-semibold mb-2 text-gray-800">作业2: 学员奖励系统</h3>
                            <p class="text-gray-600 mb-4">从键盘录入学员的成绩x，根据学员的成绩x给予奖励，如果成绩x小于等于80分的不予奖励并罚一个iphone6s，成绩81≤x≤90则奖励一个iphone4，如果成绩90＜x≤100则奖励一个iphone4，再奖励一个ipad</p>
                            <div class="flex flex-wrap gap-2">
                                <span class="bg-indigo-100 text-indigo-600 px-3 py-1 rounded-full text-sm">if语句</span>
                                <span class="bg-indigo-100 text-indigo-600 px-3 py-1 rounded-full text-sm">嵌套if</span>
                                <span class="bg-indigo-100 text-indigo-600 px-3 py-1 rounded-full text-sm">逻辑运算符</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-100 py-8">
        <div class="container mx-auto px-4 text-center">
            <h3 class="text-xl font-bold mb-2">技术小馆</h3>
            <a href="http://www.yuque.com/jtostring" class="text-indigo-300 hover:text-white transition duration-300">
                <i class="fas fa-external-link-alt mr-1"></i> http://www.yuque.com/jtostring
            </a>
            <div class="mt-4">
                <p class="text-gray-400 text-sm">© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```